using BuildingBlocks.Core.Entities;
using Catalog.Domain.Exceptions;

namespace Catalog.Domain.Entities;
public class Brand : EntityBase<Guid>
{
    public string Name { get; private set; }
    public string? Description { get; private set; }

    private Brand(string name, string? description)
    {
        Name = name;
        Description = description;
    }

    public static Brand Create(string name, string? description)
    {
        return new Brand(name, description);
    }



    public void ChangeName(string newName)
    {
        if (string.IsNullOrWhiteSpace(newName))
            throw new DomainException("Name not be empty");

        if (newName == Name) return;

        Name = newName;
    }

    public void ChangeDescription(string? newDescription)
    {

        if (newDescription == Description) return;

        Description = newDescription;
    }
}